import functools
import datetime


def timethis_my_again(func):
    @functools.wraps(func)
    def decorator(*args, **kwargs):
        t1 = datetime.datetime.now()
        result = func(*args, **kwargs)
        t2 = datetime.datetime.now()
        delta = t2 - t1
        print(f'timethis_my_again: {func.__name__}: {delta}')
        return result
    return decorator


if '__main__' == __name__:

    @timethis_my_again
    def count_down(n: int):
        n_ = n
        t1 = datetime.datetime.now()
        while n > 0:
            n -= 1
        t2 = datetime.datetime.now()
        delta = t2 - t1
        print('count_down:', n_, delta)
        return delta

    print(count_down(1e6))

    def count_down02(n: int):
        n_ = n
        t1 = datetime.datetime.now()
        while n > 0:
            n -= 1
        t2 = datetime.datetime.now()
        delta = t2 - t1
        print('countdown02:', n_, delta)
        return delta

    count_down02 = timethis_my_again(count_down02)
    print(count_down02(1e5))
